<!DOCTYPE html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Title1</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script src="<%=basePath %>web/js/jquery.min.js"></script>
    <script src="<%=basePath %>web/js/jquery.easyui.min.js"></script>
    <script src="<%=basePath %>web/js/easyui-lang-zh_CN.js"></script>
    <link rel="stylesheet" href="<%=basePath %>web/themes/icon.css">
    <link rel="stylesheet" href="<%=basePath %>web/themes/default/easyui.css">
    <link rel="stylesheet" href="<%=basePath %>web/css/wu.css">
 </head>
     <script>
        var  selectIndex = -1;

        function hideTable(){
            $("#searchdiv").toggle();
        }
       $(function(){
        	function closePart(){
	           parent.closePart();
	        }
        	$("#reset_btn").click(function(){
             	$("#form1")[0].reset();
             	$("#productList").datagrid('load',serializeForm);
             })
                var a=self.parent.$("#supplierName").val();
                var path=$("#path").val();
                $("#productList").datagrid({
                url:path+'InquiryBill/getInquiryBill_Detal?supplierName='+a,
                pageNumber:1,
                pageSize:5,
                pageList:[5,10,15],
                pagination:true,
                checkOnSelect:true,
                columns:[[
                    {field:'ck',checkbox:true},
                    {field:'code',title:'询价编号',width:140},
                    {field:'inquiryTime',title:'询价日期',width:150},
                    {field:'supplierName',title:'供应商名称',width:200},
                    {field:'amount',title:'数量',width:80},
                    {field:'amount',title:'未选数量',width:80},
                    {field:'money',title:'金额',width:100,
                       formatter:function(value,row,index){
                            return "￥"+row.money;
                       }
                    },
                    {field:'money',title:'未选金额',width:100,
                       formatter:function(value,row,index){
                            return "￥"+row.money;
                       }
                    },
                    {field:'checkStatus',title:'审核状态',width:80}
                ]],
                toolbar:'#wu_toolbar',
                  onClickRow:function(index,row){
                	$(this).datagrid("unselectRow",index);
                },
            }) 
            
	       $("#search_btn").click(function(){
		       var form=$("#form1");
	  		 $("#productList").datagrid('load',serializeForm(form));
	        })
        })
          function addpart(){
             var path=$("#path").val();
             var s= $('#productList').datagrid('getSelections')
     		  if(s!='' && s!=null){
     		  var row=JSON.stringify($('#productList').datagrid('getSelections'));
     		   	 $.ajax({
							type:"get",//请求类型
							url:path+"PurchaseOrderBill/getPart_Ib", 
							dataType:"json",//ajax接口（请求url）返回的数据类型
							data:{'data':row},
							success:function(data){//data：返回数据（json对象）
	           					parent.addpart1(data);
							 }
					    });
     		 	 }else{
		     		  $.messager.alert('我的消息','请选择询价!','warning');
		     		  return;
     		 	 }
       	}
        
	        function closePart(){
	           parent.closePart1();
	        }
         //将表单序列化
		function serializeForm(form){
			var obj={};
			$.each(form.serializeArray(),function(index){
				  if(obj[this['name']]){
					obj[this['name']]=obj[this['name']]+','+this['value']
				 }else{
				   obj[this['name']]=this['value'];
				 }
			});
			return obj;
		} 
     </script>
  
  <body>
    <div id="wu_toolbar">
    <input type="hidden" id="path" value="<%=basePath%>"/>
    <div id="searchdiv" style="display: block;width: 100%;">
        <form name="form1" id="form1"> 
            <table width="100%" border="0" cellspacing="0" style="background-color:#c9dfff;" >
                <tbody><tr>
                    <td width="70" align="right">询价编号:</td>
                    <td width="90" align="left"><input name="code" class="easyui-textbox" type="text" id="code" value="" maxlength="70" style="width:120px;height:30px"></td>
                    <td width="70"  align="right" class="l-table-edit-td">开始日期：</td>
            			<td width="43" align="left" class="l-table-edit-td"><input  type="text" name="inquiryTime" id="inquiryTime" value="" maxlength="30" class="easyui-datetimebox" style="height:30px" />
            		</td>
                    <td width="70"  align="right" class="l-table-edit-td">结束日期：</td>
            			<td width="43" align="left" class="l-table-edit-td"><input  type="text" name="endTime" id="endTime" value="" maxlength="30" class="easyui-datetimebox" style="height:30px" />
            		</td>
                    <td width="72">
                        <a id="search_btn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'">搜索</a>
                    </td>
                    <td width="72">
                        <a id="reset_btn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-refresh'">重置</a>
                    </td>
                </tr>
                </tbody>
            </table>
            <input type="hidden" id="menuCode" value="100001001">
        </form>
    </div>
</div>
<div id="productList" class="easyui-datagrid">

</div>
<div id="addButton" style="float:right">
  <a href="javascript:addpart()" class="easyui-linkbutton" style="margin-right: 10px" data-options="iconCls:'icon-add'">添加询价单</a>
  <a href="javascript:closePart()" class="easyui-linkbutton"  data-options="iconCls:'icon-delete3'">退出</a>
</div>
  </body>
</html>
